package com.reactor.part01;

import org.junit.jupiter.api.DynamicTest;
import org.junit.jupiter.api.Test;

/**
 * @author yaoyang
 * @date 2021/10/25 下午10:18
 * @description：
 **/
public class VolatileExample {
    int x = 0;
    volatile  boolean v = false;
    public void writer(){
        x = 42;
        v = true;
    }
    public void reader(){
        if (v = true){
            System.out.println(x);
        }
    }
    @Test
    public void test() {
        writer();
        reader();
    }
}
